<template>
  <el-card>
    
    <div slot="header" class="clearfix">
      <span>编辑影院</span>
    </div>
    <!-- 表单 -->
    <From :form="form">
      
      <el-form-item>
        <el-button type="primary" @click="onSubmit" :loading="loading">提交</el-button>
        <!-- <el-button>取消</el-button> -->
      </el-form-item>
    </From>
  </el-card>
</template>

<script>
import From from "./From";
export default {
  data() {
    return {
      loading: false,
      form: {}
    };
  },
  components: {
    From
  },

  created() {
    this.getDetail();
  },

  methods: {
    async getDetail() {
      let filmId = this.$route.params.filmId;
      let url = "/film/getDetail";
      let data = {
        params: {
          filmId
        }
      };
      let res = await this.$axios.get(url, data);
      console.log(res);
      this.form = res.film;
    },

    async onSubmit() {
      let url = "/film/edit";
      let data = this.form;
      this.loading = true;
      try {
        let res = await this.$axios.post(url, data);
        this.$message({
          message: "编辑影院成功",
          type: "success"
        });
      } catch (error) {}
      this.loading = false;
    }
  }
};
</script>

<style>
</style>
